from datetime import datetime, date
from pydantic import BaseModel, Field, ConfigDict
from typing import Optional, Literal
from pydantic.alias_generators import to_camel
from module_admin.annotation.pydantic_annotation import as_query

class EmployeeSocialSecurityModel(BaseModel):
    """
    员工社保表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    id: Optional[int] = Field(default=None, description='社保ID')
    employee_id: Optional[int] = Field(default=None, description='员工ID')
    name: Optional[str] = Field(default=None, description='员工姓名', alias='employeeName')
    is_paying: Optional[bool] = Field(default=False, description='是否正在缴纳')
    social_security_amount: Optional[float] = Field(default=0, description='社保缴纳金额')
    start_date: Optional[date] = Field(default=None, description='开始日期')
    end_date: Optional[date] = Field(default=None, description='结束日期')
    del_flag: Optional[Literal['0', '2']] = Field(default='0', description='删除标志（0代表存在 2代表删除）')
    create_by: Optional[str] = Field(default=None, description='创建者')
    create_time: Optional[datetime] = Field(default=None, description='创建时间')
    update_by: Optional[str] = Field(default=None, description='更新者')
    update_time: Optional[datetime] = Field(default=None, description='更新时间')

@as_query
class EmployeeSocialSecurityQueryModel(EmployeeSocialSecurityModel):
    """
    员工社保管理查询模型
    """
    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')
    begin_time: Optional[str] = Field(default=None, description='开始时间')
    end_time: Optional[str] = Field(default=None, description='结束时间')

class DeleteEmployeeSocialSecurityModel(BaseModel):
    """
    删除员工社保模型
    """
    model_config = ConfigDict(alias_generator=to_camel)

    security_ids: str = Field(default=None, description='需要删除的社保id')
    update_by: Optional[str] = Field(default=None, description='更新者')
    update_time: Optional[str] = Field(default=None, description='更新时间') 